import { APIPath } from "@/util/api/index";
import axios from "@/util/axios";
import { message } from "antd";
import { Dispatch } from "@/store";

const defaultState: any = {};

export default {
  state: defaultState,
  reducers: {},

  effects: (dispatch: Dispatch) => ({
    // 条件分页查询协同办公列表
    async getBeastList(params: {
      page: number;
      limit: number;
      [keys: string]: any;
    }) {
      try {
        const res: any = await axios.get(APIPath.getBeasts, {
          params,
        });
        return res;
      } catch (err) {
        message.error("网络错误，请重试");
      }
      return;
    },

    async getActiveLog(params: {
      page: number;
      limit: number;
      [keys: string]: any;
    }) {
      try {
        const res: any = await axios.get(APIPath.getActiveLog, {
          params,
        });
        return res;
      } catch (err) {
        message.error("网络错误，请重试");
      }
      return;
    },

    async getBeastProducitionLogs(params: {
      page: number;
      limit: number;
      [keys: string]: any;
    }) {
      try {
        const res: any = await axios.get(APIPath.getBeastProducitionLogs, {
          params,
        });
        return res;
      } catch (err) {
        message.error("网络错误，请重试");
      }
      return;
    },
  }),
};
